﻿@if(!string.IsNullOrEmpty(ViewBag.CompanyProfile.Latitude) && !string.IsNullOrEmpty(ViewBag.CompanyProfile.Longitude)) {
<h5 class="title">Kroki - Harita</h5>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA23KRFGOT_IUjCj8HhJGCIxRh84yCuHrl2kHhpFjnxJ8EhlNi4RR7UahDgeZAbnDTmOKGchI1DdN4Wg type="text/javascript"></script>
<script type="text/javascript">
var mapLat='@Html.Raw(ViewBag.CompanyProfile != null && !string.IsNullOrEmpty(ViewBag.CompanyProfile.Latitude)?ViewBag.CompanyProfile.Latitude: "")';
var mapLon='@Html.Raw(ViewBag.CompanyProfile != null && !string.IsNullOrEmpty(ViewBag.CompanyProfile.Longitude)?ViewBag.CompanyProfile.Longitude: "")';
var name='@Html.Raw(ViewBag.CompanyProfile != null && ViewBag.CompanyProfile.Name != null?ViewBag.CompanyProfile.Name: "")';
var address='@Html.Raw(ViewBag.CompanyProfile != null && ViewBag.CompanyProfile.Address != null?ViewBag.CompanyProfile.Address: "")';


//<![CDATA[

function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
// map types
// G_NORMAL_MAP- the default view
// G_SATELLITE_MAP - showing Google Earth satellite images
// G_HYBRID_MAP - showing a mixture of normal and satellite views
// G_DEFAULT_MAP_TYPES - an array of these three types, useful for iterative processing
map.setMapType(G_HYBRID_MAP);
var mapIcon = new GIcon(G_DEFAULT_ICON);
markerOptions = { icon:mapIcon };
map.setCenter(new GLatLng(mapLat,mapLon), 15);
//map.setMapType(G_SATELLITE_MAP);
var point = new GLatLng(mapLat,mapLon);
map.openInfoWindowHtml(map.getCenter(),"<table border=0 cellspacing=0 cellpadding=2>@if(ViewBag.CompanyProfile.Image != null) {<tr><td><img src='@Url.FrontUrl().ResizeImageUrl(ViewBag.CompanyProfile.Image,100,100)' /></td></tr>}<tr><td height=25 align=left valign=middle><strong>"+name+"</strong><br />"+address+"</td></tr></table>");
map.addOverlay(new GMarker(point,markerOptions));
map.addControl(new GSmallMapControl());
map.addControl(new GOverviewMapControl());
map.addControl(new GMapTypeControl());
}
}

$(document).ready(function(){initialize();});
//]]>
</script>
<div id="map_canvas" style="width: 548px; height: 440px"></div>
}
